package com.cloneoner.test.slider.data
{
	import fr.digitas.flowearth.core.Iterator;
	import fr.digitas.flowearth.core.IIterator;
	import fr.digitas.flowearth.conf.Conf;
	/**
	 * @author Thibault Loup
	 */
	public class DataProvider
	{
		
		public function DataProvider()
		{
			_build();
		}
		
		public function getImgs():IIterator
		{
			return new Iterator(_imgsURL);
		}
		
		private function _build():void
		{
			var xml:XML = Conf.getDatas("imgs");
			var node:XML;
			
			var it:ItemData;
			var w:int = Conf.getNumber("width_img");
			var h:int = Conf.getNumber("height_img");
			var c:uint = parseInt(Conf.getString("color_img"));
			var id:int;
			
			_imgsURL = [];
			
			for each( node in xml.children())
			{
				it = new ItemData();
				it._id = id;
				it._src = node.text();
				it._width = w;
				it._height = h;
				it._color = c;
				
				_imgsURL.push(it);
				
				++id;
			}
			
		}
		
		private var _imgsURL:Array;
	}
}
